#pragma once
#ifndef __LIT__NAMED__INCLUDED__HH__
#define __LIT__NAMED__INCLUDED__HH__

#include <string>
#include <LitPrerequisites.h>
#include <LitString.h>

namespace Lit
{
	template<bool allow_setter=true>
	class LIT_API Named
	{
	public:
		typename typedef String NameType;
		typename typedef String::char_type NameChars;

	protected:
		String mName;

	public:
		Named(const String &name=""):mName(name){}
		Named(const Named<allow_setter> &rk):mName(rk.mName){}
		virtual ~Named(void){}
		
		Named<allow_setter>& operator=(const NameChars * name){ mName = T(name); return *this; }
		Named<allow_setter>& operator=(const String &name){ mName = name; return *this; }
		Named<allow_setter>& operator=(const Named<allow_setter> &rk){ mName = rk.mName; return *this; }

		void setName( const String &name ){ mName = name; }
		const String & getName() const{ return mName; }
	};

	template<>
	class LIT_API Named<false>
	{
	public:
		typedef String NameType;
		typedef String::char_type NameChars;
	public:
		Named(const String &name=""):mName(name){}
		Named(const Named<false> &rk):mName(rk.mName){}
		virtual ~Named(void){}
		
		Named<false>& operator=(const NameChars * name){ mName = String(name); return *this; }
		Named<false>& operator=(const String &name){ mName = name; return *this; }
		Named<false>& operator=(const Named<false> &rk){ mName = rk.mName; return *this; }

		void setName( const String &name ){ mName = name; }
		const String & getName() const{ return mName; }

	protected:
		String mName;

	};

};

#endif